// 递归
var sumNumbers = function (root) {
  if (!root) return 0;
  let sum = 0;
  function recur (root, cur) {
    cur = cur * 10 + root.val;
    if (!root.left && !root.right) sum += cur;
    if (root.left) recur(root.left, cur);
    if (root.right) recur(root.right, cur);
  }
  recur(root, 0);
  return sum;
}